package com.example.jpatest.controller.grapgql;

import com.coxautodev.graphql.tools.GraphQLQueryResolver;
import com.coxautodev.graphql.tools.GraphQLResolver;
import com.example.jpatest.entity.Student;
import com.example.jpatest.service.StudentService;
import graphql.schema.DataFetchingEnvironment;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 学生Resolver
 * @author czx
 */
@Component
@AllArgsConstructor
public class StudentQueryResolver implements GraphQLQueryResolver {

    @Autowired
    StudentService studentService;

    public Student student(String studentNumber){
        return studentService.getByStudentNumber(studentNumber);
    }
}
